//
//  AppDelegate.m
//  02-HomeWork
//
//  Created by 李昊林 on 16/7/15.
//  Copyright © 2016年 李昊林. All rights reserved.
//

#import "AppDelegate.h"
#import "UIView+lable.h"
#import "LoginViewController.h"
#import "ViewController.h"
@interface AppDelegate ()<UITextFieldDelegate>
@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    _window.backgroundColor = [UIColor whiteColor];
    _window.rootViewController = [[ViewController alloc] init];
    [_window makeKeyAndVisible];
    
   ViewController *vc = [[ViewController alloc] init];
    UINavigationController *navigation = [[UINavigationController alloc] initWithRootViewController:vc];
    _window.rootViewController = navigation;

    //Blackground
    UIImage *myImage = [UIImage imageNamed:@"welcome_2.jpg"];
    UIImageView *imageView = [[UIImageView alloc] initWithImage:myImage];
 
    
    

    //Logo
    UIImage *myImage1 = [UIImage imageNamed:@"logo_lagou@2x.png"];
    UIImageView *imageView1 = [[UIImageView alloc] initWithImage:myImage1];
    [imageView addSubview:imageView1];
    imageView1.center = CGPointMake([UIScreen mainScreen].bounds.size.width/2, 150);
    
    //用户黑框
    UIImage *user = [UIImage imageNamed:@"屏幕快照 2016-07-15 19.36.05.png"];
    UIImageView *imageview2 = [[UIImageView alloc] initWithImage:user];
    [imageView addSubview:imageview2];
    imageview2.hl_x = 20;
    imageview2.hl_y = 270;
    imageview2.hl_height = 60;
    imageview2.hl_width = 60;
    imageview2.alpha = 1.0;
    
    
    UIView *view1 = [[UIView alloc] initWithFrame:CGRectMake(20, 270, 60, 60)];
    view1.backgroundColor = [UIColor blackColor];
    [imageView addSubview:view1];
    [imageView insertSubview:imageview2 aboveSubview:view1];
    
    //密码黑框
    UIImage *password = [UIImage imageNamed:@"屏幕快照 2016-07-15 19.36.25.png"];
    UIImageView *imageview3 = [[UIImageView alloc] initWithImage:password];
    [imageView addSubview:imageview3];
    imageview3.hl_x = 20;
    imageview3.hl_y = 335;
    imageview3.hl_height = 60;
    imageview3.hl_width = 60;
    imageview3.alpha = 1.0;
    
    UIView *view2 = [[UIView alloc] initWithFrame:CGRectMake(20, 335, 60, 60)];
    view2.backgroundColor = [UIColor blackColor];
    [imageView addSubview:view2];
    [imageView insertSubview:imageview3 aboveSubview:view2 ];
    
    
    //用户名
    UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(80,270,314,60)];
    textField.backgroundColor = [UIColor blackColor];
    [_window addSubview:textField];
    textField.alpha = 0.2;
    textField.text = @"请输入手机号";
    textField.textColor = [UIColor whiteColor];
    textField.borderStyle = UITextBorderStyleRoundedRect;
    textField.clearsOnBeginEditing = YES;
    textField.delegate = self;
    
    UITextField *textField1 = [[UITextField alloc] initWithFrame:CGRectMake(80,335,200,60)];
    textField1.backgroundColor = [UIColor blackColor];
    [_window addSubview:textField1];
    textField1.alpha = 0.2;
    textField1.text = @"请输入验证码";
    textField1.textColor = [UIColor whiteColor];
    textField1.borderStyle = UITextBorderStyleRoundedRect;
    textField1.clearsOnBeginEditing = YES;
    textField1.delegate = self;
    
    
    
    UIImage *agreements = [UIImage imageNamed:@"屏幕快照 2016-07-15 20.49.22.png"];
    UIImageView *imageview5 = [[UIImageView alloc] initWithImage:agreements];
    [imageView addSubview:imageview5];
    imageview5.hl_x = 50;
    imageview5.hl_y = 400;
    imageview5.hl_height = 30;
    imageview5.hl_width = 314;
    imageview5.alpha = 1.0;


    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
    button.backgroundColor = [UIColor yellowColor];
    [_window addSubview:button];
    button.alpha = 0.6;
    button.hl_x = 285;
    button.hl_y = 335;
    button.hl_height = 60;
    button.hl_width = 109;
    [_window addSubview:button];
    [button addTarget:self action:@selector(buttonClicked) forControlEvents:UIControlEventTouchUpInside];
    [button setTitle:@"发送验证码" forState:UIControlStateNormal];
    [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    
    UIButton *loginBtn = [UIButton buttonWithType:UIButtonTypeSystem];
    loginBtn.backgroundColor = [UIColor yellowColor];
    [_window addSubview:loginBtn];
    loginBtn.alpha = 0.6;
    loginBtn.hl_x = 50;
    loginBtn.hl_y = 450;
    loginBtn.hl_height = 50;
    loginBtn.hl_width = 314;
    [_window addSubview:loginBtn];
    [loginBtn addTarget:self action:@selector(buttonClicked) forControlEvents:UIControlEventTouchUpInside];
    [loginBtn addTarget:self action:@selector(loginBtn:) forControlEvents:UIControlEventTouchUpInside];
    [loginBtn setTitle:@"注册" forState:UIControlStateNormal];
    [loginBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    
    UIButton *button2 = [UIButton buttonWithType:UIButtonTypeSystem];
    button2.backgroundColor = [UIColor yellowColor];
    [_window addSubview:button2];
    button2.alpha = 0.6;
    button2.hl_x = 50;
    button2.hl_y = 515;
    button2.hl_height = 50;
    button2.hl_width = 314;
    [_window addSubview:button2];
    [button2 addTarget:self action:@selector(buttonClicked) forControlEvents:UIControlEventTouchUpInside];
    [button2 setTitle:@"返回登录" forState:UIControlStateNormal];
    [button2 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    

    
    //第二页
//    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
//    _window.rootViewController = [[UIViewController alloc]init];
//    //Blackground
//    UIImage *myImage = [UIImage imageNamed:@"welcome_2.jpg"];
//    UIImageView *imageView = [[UIImageView alloc] initWithImage:myImage];
//    [_window addSubview:imageView];
//    [_window makeKeyAndVisible];
//    //Logo
//    UIImage *myImage1 = [UIImage imageNamed:@"logo_lagou@2x.png"];
//    UIImageView *imageView1 = [[UIImageView alloc] initWithImage:myImage1];
//    [imageView addSubview:imageView1];
//    imageView1.center = CGPointMake([UIScreen mainScreen].bounds.size.width/2, 150);
 
//        UIImage *user = [UIImage imageNamed:@"屏幕快照 2016-07-15 19.36.05.png"];
//        UIImageView *imageview2 = [[UIImageView alloc] initWithImage:user];
//        [imageView addSubview:imageview2];
//        imageview2.hl_x = 20;
//        imageview2.hl_y = 270;
//        imageview2.hl_height = 60;
//        imageview2.hl_width = 60;
//        imageview2.alpha = 1.0;
//    
//    
//        UIView *view1 = [[UIView alloc] initWithFrame:CGRectMake(20, 270, 60, 60)];
//        view1.backgroundColor = [UIColor blackColor];
//        [imageView addSubview:view1];
//        [imageView insertSubview:imageview2 aboveSubview:view1];
//    
//        //密码黑框
//        UIImage *password = [UIImage imageNamed:@"屏幕快照 2016-07-15 19.36.25.png"];
//        UIImageView *imageview3 = [[UIImageView alloc] initWithImage:password];
//        [imageView addSubview:imageview3];
//        imageview3.hl_x = 20;
//        imageview3.hl_y = 335;
//        imageview3.hl_height = 60;
//        imageview3.hl_width = 60;
//        imageview3.alpha = 1.0;
//    
//        UIView *view2 = [[UIView alloc] initWithFrame:CGRectMake(20, 335, 60, 60)];
//        view2.backgroundColor = [UIColor blackColor];
//        [imageView addSubview:view2];
//        [imageView insertSubview:imageview3 aboveSubview:view2 ];
//    
//    
//        //用户名
//        UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(80,270,314,60)];
//        textField.backgroundColor = [UIColor blackColor];
//        [_window addSubview:textField];
//        textField.alpha = 0.2;
//        textField.text = @"请输入已验证的手机号";
//        textField.textColor = [UIColor whiteColor];
//        textField.borderStyle = UITextBorderStyleRoundedRect;
//        textField.clearsOnBeginEditing = YES;
//        textField.delegate = self;
//    
//        UITextField *textField1 = [[UITextField alloc] initWithFrame:CGRectMake(80,335,314,60)];
//        textField1.backgroundColor = [UIColor blackColor];
//        [_window addSubview:textField1];
//        textField1.alpha = 0.2;
//        textField1.text = @"请输入密码";
//        textField1.textColor = [UIColor whiteColor];
//        textField1.borderStyle = UITextBorderStyleRoundedRect;
//        textField1.clearsOnBeginEditing = YES;
//        textField1.delegate = self;
//    
//    
//        UIButton *loginBtn = [UIButton buttonWithType:UIButtonTypeSystem];
//        loginBtn.backgroundColor = [UIColor yellowColor];
//        [_window addSubview:loginBtn];
//        loginBtn.alpha = 0.6;
//        loginBtn.hl_x = 50;
//        loginBtn.hl_y = 450;
//        loginBtn.hl_height = 50;
//        loginBtn.hl_width = 314;
//        [_window addSubview:loginBtn];
//        [loginBtn addTarget:self action:@selector(buttonClicked) forControlEvents:UIControlEventTouchUpInside];
//        [loginBtn addTarget:self action:@selector(loginBtn:) forControlEvents:UIControlEventTouchUpInside];
//        [loginBtn setTitle:@"登录" forState:UIControlStateNormal];
//        [loginBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
//    
//        UIButton *button2 = [UIButton buttonWithType:UIButtonTypeSystem];
//        button2.backgroundColor = [UIColor yellowColor];
//        [_window addSubview:button2];
//        button2.alpha = 0.6;
//        button2.hl_x = 50;
//        button2.hl_y = 515;
//        button2.hl_height = 50;
//        button2.hl_width = 314;
//        [_window addSubview:button2];
//        [button2 addTarget:self action:@selector(buttonClicked) forControlEvents:UIControlEventTouchUpInside];
//        [button2 setTitle:@"注册" forState:UIControlStateNormal];
//        [button2 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    //第三页
//    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
//    _window.rootViewController = [[UIViewController alloc]init];
//    //Blackground
 //   _window.backgroundColor = [UIColor whiteColor];
//    UIImage *myImage = [UIImage imageNamed:@"welcome_2.jpg"];
//    UIImageView *imageView = [[UIImageView alloc] initWithImage:myImage];
//    [_window addSubview:imageView];
//    [_window makeKeyAndVisible];
    //Logo
//    UILabel *lable = [[UILabel alloc] initWithFrame:CGRectMake(180, 100, 100, 40)];
//    lable.backgroundColor = [UIColor whiteColor];
//    [_window addSubview:lable];
//    lable.text = @"验证手机";
//    lable.textColor = [UIColor blackColor];
//    lable.font = [UIFont systemFontOfSize:40];
//    lable.font = [UIFont boldSystemFontOfSize:40];
    
//验证手机页面
//    UIButton *button2 = [UIButton buttonWithType:UIButtonTypeSystem];
//            button2.backgroundColor = [UIColor whiteColor];
//            [_window addSubview:button2];
//            button2.alpha = 0.6;
//            button2.hl_x = 20;
//            button2.hl_y = 30;
//            button2.hl_height = 20;
//            button2.hl_width = 40;
//            [_window addSubview:button2];
//            [button2 addTarget:self action:@selector(buttonClicked) forControlEvents:UIControlEventTouchUpInside];
//            [button2 setTitle:@"返回" forState:UIControlStateNormal];
//            [button2 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
//    
//            UIImage *user = [UIImage imageNamed:@"屏幕快照 2016-07-15 19.36.05.png"];
//            UIImageView *imageview2 = [[UIImageView alloc] initWithImage:user];
//            [_window addSubview:imageview2];
//            imageview2.hl_x = 20;
//            imageview2.hl_y = 270;
//            imageview2.hl_height = 60;
//            imageview2.hl_width = 60;
//            imageview2.alpha = 1.0;
//    
//    
//            UIView *view1 = [[UIView alloc] initWithFrame:CGRectMake(20, 270, 60, 60)];
//            view1.backgroundColor = [UIColor blackColor];
//            [_window addSubview:view1];
//            [_window insertSubview:imageview2 aboveSubview:view1];
//    
//            //密码黑框
//            UIImage *password = [UIImage imageNamed:@"屏幕快照 2016-07-15 19.36.25.png"];
//            UIImageView *imageview3 = [[UIImageView alloc] initWithImage:password];
//            [_window addSubview:imageview3];
//            imageview3.hl_x = 20;
//            imageview3.hl_y = 335;
//            imageview3.hl_height = 60;
//            imageview3.hl_width = 60;
//            imageview3.alpha = 1.0;
//    
//            UIView *view2 = [[UIView alloc] initWithFrame:CGRectMake(20, 335, 60, 60)];
//            view2.backgroundColor = [UIColor blackColor];
//            [_window addSubview:view2];
//            [_window insertSubview:imageview3 aboveSubview:view2 ];
//    
//    

//            UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(80,270,314,60)];
//            textField.backgroundColor = [UIColor blackColor];
//            [_window addSubview:textField];
//            textField.alpha = 0.2;
//            textField.text = @"请输入已验证的手机号";
//            textField.textColor = [UIColor whiteColor];
//            textField.borderStyle = UITextBorderStyleRoundedRect;
//            textField.clearsOnBeginEditing = YES;
//            textField.delegate = self;
//    
//            UITextField *textField1 = [[UITextField alloc] initWithFrame:CGRectMake(80,335,314,60)];
//            textField1.backgroundColor = [UIColor blackColor];
//            [_window addSubview:textField1];
//            textField1.alpha = 0.2;
//            textField1.text = @"请输入密码";
//            textField1.textColor = [UIColor whiteColor];
//            textField1.borderStyle = UITextBorderStyleRoundedRect;
//            textField1.clearsOnBeginEditing = YES;
//            textField1.delegate = self;
//    
//    UIButton *loginBtn = [UIButton buttonWithType:UIButtonTypeSystem];
//            loginBtn.backgroundColor = [UIColor greenColor];
//            [_window addSubview:loginBtn];
//            loginBtn.alpha = 0.6;
//            loginBtn.hl_x = 50;
//            loginBtn.hl_y = 450;
//            loginBtn.hl_height = 50;
//            loginBtn.hl_width = 314;
//            [_window addSubview:loginBtn];
//            [loginBtn addTarget:self action:@selector(buttonClicked) forControlEvents:UIControlEventTouchUpInside];
//    
//            [loginBtn setTitle:@"下一步" forState:UIControlStateNormal];
//            [loginBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
// 
//            UIButton *button3 = [UIButton buttonWithType:UIButtonTypeSystem];
//            button3.backgroundColor = [UIColor yellowColor];
//            [_window addSubview:button3];
//            button3.alpha = 0.6;
//            button3.hl_x = 50;
//            button3.hl_y = 515;
//            button3.hl_height = 50;
//            button3.hl_width = 314;
//            [_window addSubview:button3];
//            [button3 addTarget:self action:@selector(buttonClicked) forControlEvents:UIControlEventTouchUpInside];
//            [button3 setTitle:@"忘记密码" forState:UIControlStateNormal];
//            [button3 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];

    
    
    
    return YES;
   
    
    
   
  
   
  
    

    
   
   

    
    
      
    
    
    
    
    
    


}

- (void)loginBtn:(UIButton *)loginBtn {
    NSLog(@"注册");
}
- (void)buttonClicked {
    [_window endEditing:YES];
    NSLog(@"发送验证码");
}
//- (void)loginBtn:(UIButton *) sender {
//    LoginViewController *loginVC = [[LoginViewController alloc] init];
////    [self presentViewController:loginVC animated:YES completion:nil];
//}



- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
   
    return YES;
}

- (void)textFieldDidBeginEditing:(UITextField *)textField {
    
}
- (void)textFieldDidEndEditing:(UITextField *)textField {
    
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    
    return YES;
}


- (void)applicationWillResignActive:(UIApplication *)application {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application {
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

@end
